using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Xna.Framework;
using BoOnce.Steps;
using BoOnce.Helpers;

namespace BoOnce.Menu
{
    class MainMenu : MenuScreen
    {
        public MainMenu(Menu menu)
            : base(menu,"Main menu")
        {
            MenuItem OnePlayer = new MenuItem("One player");
            OnePlayer.Selected += OnePlayerSelected;

            MenuItem TwoPlayer = new MenuItem("Two players");
            TwoPlayer.Selected += TwoPlayerSelected;

            MenuItem Option = new MenuItem("Option");
            Option.Selected += OptionSelected;

            MenuItem Exit = new MenuItem("Quit");
            Exit.Selected += ExitSelected;

            Add(OnePlayer);
            Add(TwoPlayer);
            Add(Option);
            Add(Exit);
        }

        void OnePlayerSelected(object sender, EventArgs e)
        {
            //StepTransitionComponent STC = (StepTransitionComponent)BaseGame.GetInstance().Services.GetService(typeof(StepTransitionComponent));
            //BaseGame.GetBaseGameInstance().GoTo(new IntroStep(BaseGame.GetInstance()));
        }

        void TwoPlayerSelected(object sender, EventArgs e){
            Logger.WriteInfo("Two player selected");
        }

        void ExitSelected(object sender, EventArgs e)
        {
            BaseGame.GetInstance().Exit();
        }

        void OptionSelected(object sender, EventArgs e)
        {
            Logger.WriteInfo("Option selected");
            _Menu.TransitionTo("option");
        }

        public override void LoadContent()
        {
            base.LoadContent();
        }

        public override void Update(GameTime gameTime)
        {
            //if (InputComponent.IsNewPress(PlayerIndex.One, InputComponent.Buttons.Down))
            //    HighlightNextEntry();

            //if (InputComponent.IsNewPress(PlayerIndex.One, InputComponent.Buttons.Up))
            //    HighlightPreviousEntry();

            //if (InputComponent.IsNewPress(PlayerIndex.One, InputComponent.Buttons.Action1))
            //    SelectHighlightedEntry();
                

            base.Update(gameTime);
        }
    }
}
